﻿@model ListViewModel<CommonSearchValues, IQueryable<SmsReceived>>
@{
    ViewBag.Title = "接收短信查询";
    List<aspnet_Users> uns = ViewBag.Users;
    aspnet_Users tempsr = null;
}
@using (Ajax.BeginForm("ReceivedSms", new { _dataonly = "yes", IsView = false }, new AjaxOptions { HttpMethod = "Post", LoadingElementId = "OnLoadingSpan", UpdateTargetId = "main", OnFailure = "OnSiteError" }))
{<p>
    <fieldset>
        <legend>
            <div class="catalog-title">
                接收短信查询</div>
        </legend>
        <div class="small-input">
            @Html.HiddenFor(m => Model.PageSize)
            <input type="hidden" name="PageIdx" id="qspidx" value="0" />
            发送时间：@Html.EditorFor(m => m.SearchFrom.V1, "DateTimeStr")
            至：@Html.EditorFor(m => m.SearchTo.V1, "DateTimeStr")
            发送者：@Html.TextBoxFor(m => m.SearchFrom.V2)
            电话号码：@Html.TextBoxFor(m => m.SearchFrom.V3)
            @Helpers.SubmitButton("查询", "qssubmit")
        </div>
    </fieldset>
    </p>
}
<table class="width">
    <tr>
        <th>
            发送者电话
        </th>
        <th>
            发送者
        </th>
        </th>
        <th>
            短信内容
        </th>
        <th>
            发送时间
        </th>
        <th>
            状态
        </th>
    </tr>
    @{int dColor = 0;}
    @foreach (var item in Model.Data)
    {
        <tr class="tr-backColor@(dColor++ % 2)">
            <td>@Html.DisplayFor(model => item.SenderCode)
                @*@Ajax.ActionLink(item.SenderCode, "GetUserByPhone", new { ID = item.ID, _utid = "ListView" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('患者信息');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })*@
            </td>
            
            <td>@((tempsr = uns.FirstOrDefault(v => v.MobileAlias == item.SenderCode || "86" + v.MobileAlias == item.SenderCode)) == null ? "" : tempsr.UserName)
            </td>
            <td>@Html.DisplayFor(model => item.TextMessage)
            </td>
            <td>@Html.DisplayFor(model => item.SentTime)
            </td>
            <td>@Html.DisplayFor(model => item.ProcStatus)
            </td>
        </tr>
    }
</table>
@Html.Partial("Pagger", new PaggerViewModel { Act = "ReceivedSms", PageIdx = Model.PageIdx, PageCount = Model.PageCount, ItemCount = Model.ItemCount })
@Html.Partial("TrHilighter")